//
//  LoginView.swift
//  hunan_ios_ldnsm
//
//  Created by I-Q-I on 2019/4/28.
//  Copyright © 2019 I-Q-I. All rights reserved.
//

import UIKit
import LLCycleScrollView
class HomeView: UIView {
    
     lazy var bannerView: LLCycleScrollView = {
        let el = LLCycleScrollView()
        el.backgroundColor = UIColor.background
        //设置滚动条为长方条
        el.customPageControlStyle = .pill
        el.customPageControlTintColor = UIColor.colOrange
        el.pageControlPosition = .center
        el.autoScrollTimeInterval = 6
        el.placeHolderImage = UIImage(named: "normal_placeholder")
        el.coverImage = UIImage()
        el.pageControlBottom = 20
        el.titleBackgroundColor = UIColor.clear
        
        return el
    }()
     lazy var infoView: UIView = {
        let el = UIView()
        el.backgroundColor = UIColor.white
        return el
    }()
     lazy var attestView: UIView = {
        let el = UIView()
       el.backgroundColor = UIColor.background
        return el
    }()
    lazy var attestLabel: UILabel = {
        let el = LabelPadding()
        el.textInsets = UIEdgeInsets(top: 6, left: 6, bottom: 0, right: 0)
        el.textColor = #colorLiteral(red: 0.168627451, green: 0.7568627451, blue: 0.9058823529, alpha: 1)
        el.font = UIFont.middle
          el.text = "认证信息"
        return el
    }()
    
    lazy var attestPic: UIImageView = {
        let el = UIImageView()
        el.frame = CGRect(x:0, y:0, width:70, height:70)
        el.image = #imageLiteral(resourceName: "icon")
        return el
    }()
     lazy var serveView: UIView = {
        let el = UIView()
        el.backgroundColor = UIColor.background
        return el
    }()
    lazy var serveLabel: UILabel = {
        let el = LabelPadding()
        el.textInsets = UIEdgeInsets(top: 6, left: 6, bottom: 0, right: 0)
        el.textColor = #colorLiteral(red: 0.9058823529, green: 0.7529411765, blue: 0.3254901961, alpha: 1)
        el.text = "服务信息"
        el.font = UIFont.middle
        return el
    }()
    lazy var servePic: UIImageView = {
        let el = UIImageView()
        el.frame = CGRect(x:0, y:0, width:70, height:70)
        el.image = #imageLiteral(resourceName: "icon")
        return el
    }()
    lazy var enterBox: UIView = {
        let el = UIView()
        el.backgroundColor = UIColor.white
        return el
    }()
    lazy var enterPic: UIImageView = {
        let el = UIImageView()
        el.frame = CGRect(x:0, y:0, width:50, height:50)
        el.layer.masksToBounds = true
        el.contentMode = .scaleAspectFit
        el.layer.cornerRadius = 25
        el.image = #imageLiteral(resourceName: "icon")
        return el
    }()
    lazy var enterTitle: UILabel = {
        let el = LabelPadding()
        el.textInsets = UIEdgeInsets(top: 6, left: 6, bottom: 0, right: 0)
        el.textColor = UIColor.colBlack
        el.text = "申请入驻"
        el.font = UIFont.middle
        return el
    }()
    lazy var enterDesc: UILabel = {
        let el = LabelPadding()
        el.textInsets = UIEdgeInsets(top: 6, left: 6, bottom: 0, right: 0)
        el.textColor = UIColor.colGray
        el.text = "申请入驻,加入轮到你上门,赚大钱"
        el.font = UIFont.min
        return el
    }()
    lazy var enterBtn: UIButton = {
        let el = UIButton(type: .custom)
        el.frame = CGRect(x: 0, y: 0, width: 70, height: 30)
        el.layer.masksToBounds = true
        el.layer.cornerRadius = 4
        el.setTitle("我要加入", for: .normal)
        el.setTitleColor(UIColor.white, for: .normal)
       el.titleLabel?.font = UIFont.min
        el.backgroundColor = #colorLiteral(red: 0, green: 0.7411764706, blue: 0.7294117647, alpha: 1)
        return el
    }()
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.backgroundColor = UIColor.background
        
        self.addSubview(bannerView)
        bannerView.snp.makeConstraints{
            $0.height.equalTo(240)
            $0.left.right.equalToSuperview()
            $0.top.equalTo(0)
        }
        self.addSubview(infoView)
        infoView.snp.makeConstraints{
            $0.height.equalTo(190)
            $0.left.right.equalToSuperview()
            $0.top.equalTo(bannerView.snp.bottom).offset(2)
        }
        infoView.addSubview(attestView)
        attestView.snp.makeConstraints{
            $0.height.equalTo(150)
            $0.width.equalTo(screenWidth/2 - 22)
            $0.top.equalTo(size20)
            $0.left.equalTo(size20)
        }
        attestView.addSubview(attestLabel)
        attestLabel.snp.makeConstraints{
           $0.left.equalTo(size5)
            $0.top.equalTo(size20)
        }
        attestView.addSubview(attestPic)
        attestPic.snp.makeConstraints{
            $0.right.equalToSuperview()
            $0.top.equalTo(attestLabel.snp.bottom).offset(size10)
        }
        infoView.addSubview(serveView)
        serveView.snp.makeConstraints{
            $0.height.equalTo(150)
            $0.width.equalTo(screenWidth/2 - 22)
            $0.top.equalTo(size20)
            $0.right.equalTo(-size20)
            $0.left.equalTo(attestView.snp.right).offset(6)
        }
        serveView.addSubview(serveLabel)
        serveLabel.snp.makeConstraints{
            $0.left.equalTo(size5)
            $0.top.equalTo(size20)
        }
        serveView.addSubview(servePic)
        servePic.snp.makeConstraints{
            $0.right.equalToSuperview()
            $0.top.equalTo(attestLabel.snp.bottom).offset(size10)
        }
        self.addSubview(enterBox)
        enterBox.snp.makeConstraints{
            $0.top.equalTo(infoView.snp.bottom).offset(size15)
            $0.height.equalTo(84)
            $0.left.equalTo(size15)
            $0.width.equalTo(screenWidth/1 - 30)
        }
        enterBox.addSubview(enterPic)
        enterPic.snp.makeConstraints{
            $0.centerY.equalToSuperview()
            $0.left.equalTo(size5)
            $0.size.equalTo(50)
        }
        enterBox.addSubview(enterTitle)
        enterTitle.snp.makeConstraints{
            $0.left.equalTo(enterPic.snp.right).offset(1)
            $0.top.equalTo(20)
        }
        enterBox.addSubview(enterDesc)
        enterDesc.snp.makeConstraints{
            $0.left.equalTo(enterPic.snp.right).offset(1)
            $0.top.equalTo(enterTitle.snp.bottom)
        }
        enterBox.addSubview(enterBtn)
        enterBtn.snp.makeConstraints{
            $0.centerY.equalToSuperview()
            $0.width.equalTo(60)
            $0.height.equalTo(30)
            $0.right.equalTo(-size5)
        }
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }


    
}
